﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MongoDB.Connections;
using MongoDB;
using PicturePortfolio.Domain;
namespace PicturePortfolio.Persistance
{
    public class PhotoRepository
    {
        Mongo _mongo = null;
        public void SavePhoto(Photo photo)
        {
            try
            {
                _mongo = new Mongo();
                _mongo.Connect();
                var db = _mongo.GetDatabase("Protfolio");
                var photos = db.GetCollection<Photo>("Photos");
                photos.Save(photo);

                _mongo.Disconnect();
            }
            catch (Exception ex)
            {
                throw;
            }
        }

    }
}
